<% page_title "Kubernetes Release #{@kubernetes_release.id}" %>

<%= render 'projects/header', project: @project, tab: 'kubernetes' %>

<section class="tabs kubernetes-section">
  <%= render 'samson_kubernetes/role_navigation' %>

  <dl class="dl-horizontal">
    <dt>Build</dt>
    <dd>
      <%= link_to "Build", project_builds_path(@project, search: {git_sha: @kubernetes_release.git_sha}) %>
    </dd>
    <dt>Deploy</dt>
    <dd>
      <% if @kubernetes_release.deploy %>
        <%= link_to status_badge(@kubernetes_release.deploy.job.status), project_deploy_path(@project, @kubernetes_release.deploy) %>
      <% else %>
        None
      <% end %>
    </dd>
    <dt>Git SHA</dt>
    <dd><%= short_sha @kubernetes_release.git_sha %></dd>
    <dt>Git REF</dt>
    <dd><%= @kubernetes_release.git_ref %></dd>
  </dl>

  <h2>Docs</h2>
  <table class="table">
    <tr>
      <th>Id</th>
      <th>Deploy Group</th>
      <th>Role</th>
      <th>Replicas</th>
      <th>CPU</th>
      <th>Memory</th>
    </tr>
    <% @kubernetes_release.release_docs.each do |doc| %>
      <tr>
        <td><%= doc.id %></td>
        <td><%= link_to doc.deploy_group.name, doc.deploy_group %></td>
        <td><%= link_to doc.kubernetes_role.name, project_kubernetes_role_path(@project, doc.kubernetes_role) %></td>
        <td><%= doc.replica_target %></td>
        <td><%= doc.requests_cpu %> to <%= doc.limits_cpu %></td>
        <td><%= doc.requests_memory %> to <%= doc.limits_memory %></td>
      </tr>
    <% end %>
  </table>
</section>
